package com.huike.web.controller.system;


import com.huike.clues.domain.SysDictType;
import com.huike.clues.service.ISysDictTypeService;
import com.huike.common.core.domain.AjaxResult;
import com.huike.common.core.domain.entity.SysDictTypeDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 字典管理
 *
 * @Data 2025-8-12
 */
@RestController
@RequestMapping("/system/dict/type")
public class SysDictTypeController {

    @Autowired
    private ISysDictTypeService dictTypeService;

    /**
     * 新增字典类型
     *
     * @param dto
     * @return
     */
    @PostMapping
    public AjaxResult addDict(@RequestBody SysDictTypeDTO dto) {
        dictTypeService.addDict(dto);
        return AjaxResult.success();
    }

    /**
     * 修改字典
     * @param dictType
     * @return
     */
    @PutMapping
    public AjaxResult updateDictType(SysDictType dictType) {
        dictTypeService.updateDictType(dictType);
        return AjaxResult.success();
    }

    @GetMapping("/list")
    public AjaxResult getDictByPage(){
        return AjaxResult.success(dictTypeService.list());
    }

}
